home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / Connections.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  6.9 KB  |  262 lines  |  [TEXT/MPS ]

  1. {
  2.     Connections.p
  3.     Pascal Interface to the Connection Manager
  4.     
  5.     Copyright © Apple Computer, Inc. 1988-90
  6.     All rights reserved
  7. }
  8. {$IFC UNDEFINED UsingIncludes}
  9. {$SETC UsingIncludes := 0}
  10. {$ENDC}
  11.  
  12. {$IFC NOT UsingIncludes}
  13.     UNIT Connections;
  14.     INTERFACE
  15. {$ENDC}
  16.  
  17. {$IFC UNDEFINED UsingConnections}
  18. {$SETC UsingConnections := 1}
  19.  
  20. {$I+}
  21. {$SETC ConnectionsIncludes := UsingIncludes}
  22. {$SETC UsingIncludes := 1}
  23. {$IFC UNDEFINED UsingDialogs}
  24. {$I $$Shell(PInterfaces)Dialogs.p}
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED UsingCTBUtilities}
  28. {$I $$Shell(PInterfaces)CTBUtilities.p}
  29. {$ENDC}
  30.  
  31. {$SETC UsingIncludes := ConnectionsIncludes}
  32.  
  33. CONST
  34. { current Connection Manager version }
  35.     curCMVersion        =    2;
  36.  
  37. { current Connection Manager Environment Record version }
  38.     curConnEnvRecVers    =    0;
  39.     
  40. { error codes }
  41.     cmGenericError        =    -1;
  42.     cmNoErr                =    0;
  43.     cmRejected             =    1;
  44.     cmFailed            =    2;
  45.     cmTimeOut            =    3;
  46.     cmNotOpen            =    4;
  47.     cmNotClosed            =    5;
  48.     cmNoRequestPending    =    6;
  49.     cmNotSupported        =    7;
  50.     cmNoTools            =    8;
  51.     cmUserCancel        =    9;
  52.     cmUnknownError        =    11;
  53.  
  54. { CMRecFlags / CMChannel}
  55. {    Low word of CMRecFlags is same as CMChannel }
  56.     cmData                =     $00000001;
  57.     cmCntl                =     $00000002;
  58.     cmAttn                =     $00000004;
  59.  
  60.     cmDataNoTimeout        =     $00000010;  
  61.     cmCntlNoTimeout        =     $00000020;
  62.     cmAttnNoTimeout        =     $00000040;
  63.  
  64.     cmDataClean            =     $00000100;  
  65.     cmCntlClean            =     $00000200;
  66.     cmAttnClean            =     $00000400;
  67.  
  68.                                         {    only for CMRecFlags (not CMChannel) below this point }
  69.     cmNoMenus            =     $00010000;
  70.     cmQuiet                =     $00020000;
  71.  
  72. { CMStatFlags}
  73.     cmStatusOpening        =     $00000001;
  74.     cmStatusOpen        =     $00000002;
  75.     cmStatusClosing        =     $00000004;
  76.     cmStatusDataAvail    =     $00000008;
  77.     cmStatusCntlAvail    =     $00000010;
  78.     cmStatusAttnAvail    =     $00000020;
  79.  
  80.     cmStatusDRPend        =     $00000040;        {data read pending}
  81.     cmStatusDWPend        =     $00000080;        {data write pending}
  82.     cmStatusCRPend        =     $00000100;        {cntl read pending}
  83.     cmStatusCWPend        =     $00000200;        {cntl write pending}
  84.     cmStatusARPend        =     $00000400;        {attn read pending}
  85.     cmStatusAWPend        =     $00000800;        {attn write pending}
  86.  
  87.     cmStatusBreakPend     =    $00001000;
  88.     cmStatusListenPend     =     $00002000;
  89.     cmStatusIncomingCallPresent    
  90.                         =    $00004000;
  91.  
  92.     cmStatusReserved0    =    $00008000;
  93.  
  94. { CMSearchFlags}
  95.     cmSearchSevenBit    =     $0001;
  96.     
  97. { CMFlags}
  98.     cmFlagsEOM            =     $0001;
  99.     
  100. TYPE
  101.     CMErr                =    OSErr;
  102.     
  103.     CMBufFields = (
  104.         cmDataIn,
  105.         cmDataOut,
  106.     
  107.         cmCntlIn,
  108.         cmCntlOut,
  109.     
  110.         cmAttnIn,
  111.         cmAttnOut,
  112.         
  113.         cmRsrvIn,
  114.         cmRsrvOut
  115.     );
  116.     
  117.     CMBuffers        =    ARRAY[CMBufFields] OF Ptr;
  118.     CMBufferSizes    =    ARRAY[CMBufFields] OF LONGINT;
  119.     
  120.     CMStatFlags     =     LONGINT;
  121.     CMRecFlags         =     LONGINT;
  122.     CMChannel         =     INTEGER;
  123.     CMSearchFlags     =     INTEGER;
  124.     CMFlags         =     INTEGER;
  125.  
  126.     ConnEnvironRecPtr 
  127.                     =     ^ConnEnvironRec;
  128.     ConnEnvironRec     =    RECORD
  129.         version            :    INTEGER;
  130.         baudRate        :    LONGINT;
  131.         dataBits        :    INTEGER;
  132.         channels        :    CMChannel;
  133.         swFlowControl    :    BOOLEAN;
  134.         hwFlowControl    :    BOOLEAN;
  135.         flags            :    CMFlags;
  136.     END;
  137.     
  138.     ConnHandle        =    ^ConnPtr;
  139.     ConnPtr            =    ^ConnRecord;
  140.     ConnRecord        =    RECORD
  141.         procID        :    INTEGER;
  142.         
  143.         flags        :    CMRecFlags;
  144.         errCode        :    CMErr;
  145.         
  146.         refCon        :    LONGINT;
  147.         userData    :    LONGINT;
  148.  
  149.         defProc        :    ProcPtr;
  150.  
  151.         config        :    Ptr;
  152.         oldConfig    :    Ptr;
  153.  
  154.         asyncEOM    :    LONGINT;
  155.         
  156.         reserved1    :    LONGINT;
  157.         reserved2    :    LONGINT;
  158.  
  159.         cmPrivate    :    Ptr;
  160.         
  161.         bufferArray    :    CMBuffers;
  162.         bufSizes    :    CMBufferSizes;
  163.                 
  164.         mluField    :    LONGINT;
  165.         
  166.         asyncCount     :    CMBufferSizes;
  167.     END;
  168.     
  169.     
  170.  
  171. FUNCTION     InitCM: CMErr;
  172. FUNCTION     CMGetVersion(hConn: ConnHandle): Handle;
  173. FUNCTION     CMGetCMVersion: INTEGER;
  174.  
  175. FUNCTION      CMNew(procID: INTEGER; flags: CMRecFlags; 
  176.                     desiredSizes: CMBufferSizes; refCon: LONGINT; 
  177.                     userData: LONGINT): ConnHandle;
  178. PROCEDURE     CMDispose(hConn: ConnHandle);
  179.  
  180. FUNCTION     CMListen(hConn: ConnHandle; async: BOOLEAN; completor: ProcPTr; 
  181.                     timeout: LONGINT): CMErr;
  182. FUNCTION     CMAccept(hConn: ConnHandle; accept: BOOLEAN): CMErr;
  183.  
  184. FUNCTION     CMOpen(hConn: ConnHandle; async: BOOLEAN; completor: ProcPtr; 
  185.                     timeout: LONGINT): CMErr;
  186. FUNCTION     CMClose(hConn: ConnHandle; async: BOOLEAN; completor: ProcPtr; 
  187.                     timeout: LONGINT; now: BOOLEAN): CMErr;
  188.  
  189. FUNCTION     CMAbort(hConn: ConnHandle): CMErr;
  190.  
  191. FUNCTION     CMStatus(hConn: ConnHandle; VAR sizes: CMBufferSizes; 
  192.                     VAR flags: CMStatFlags): CMErr;
  193. PROCEDURE     CMIdle(hConn: ConnHandle);
  194.  
  195. PROCEDURE     CMReset(hConn: ConnHandle);
  196.  
  197. PROCEDURE     CMBreak(hConn: ConnHandle; duration: LONGINT; async: BOOLEAN;  
  198.                     completor: ProcPtr);
  199.  
  200. FUNCTION     CMRead(hConn: ConnHandle; theBuffer: Ptr; VAR toRead: LONGINT; 
  201.                     theChannel: CMChannel; async: BOOLEAN;  
  202.                     completor: ProcPtr; timeout: LONGINT; VAR flags: CMFlags): CMErr;
  203. FUNCTION     CMWrite(hConn: ConnHandle; theBuffer: Ptr; VAR toWrite: LONGINT; 
  204.                     theChannel: CMChannel; async: BOOLEAN; 
  205.                     completor: ProcPtr; timeout: LONGINT; flags: CMFlags): CMErr;
  206. FUNCTION     CMIOKill(hConn: ConnHandle; which: INTEGER): CMErr;
  207.  
  208. PROCEDURE     CMActivate(hConn: ConnHandle; activate: BOOLEAN);
  209. PROCEDURE     CMResume(hConn: ConnHandle; resume: BOOLEAN);
  210. FUNCTION     CMMenu(hConn: ConnHandle; menuID: INTEGER; item: INTEGER): BOOLEAN;
  211.  
  212. FUNCTION     CMValidate(hConn: ConnHandle): BOOLEAN;
  213. PROCEDURE     CMDefault(VAR theConfig: Ptr ; procID: INTEGER; allocate: BOOLEAN);
  214.  
  215. FUNCTION     CMSetupPreflight(procID: INTEGER; VAR magicCookie: LONGINT):Handle;
  216. PROCEDURE     CMSetupSetup(procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr;
  217.                         VAR magicCookie:LONGINT);
  218. FUNCTION     CMSetupFilter(procID: INTEGER; theConfig: Ptr; count: INTEGER; 
  219.                         theDialog: DialogPtr; VAR theEvent: EventRecord; VAR theItem: INTEGER;
  220.                         VAR magicCookie: LONGINT): BOOLEAN;
  221. PROCEDURE     CMSetupItem(procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr;
  222.                         VAR theItem: INTEGER; VAR magicCookie: LONGINT);
  223. PROCEDURE     CMSetupCleanup(procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr;
  224.                         VAR magicCookie: LONGINT);
  225. PROCEDURE    CMSetupPostflight(procID: INTEGER);
  226.  
  227. FUNCTION     CMGetConfig(hConn: ConnHandle): Ptr;
  228. FUNCTION     CMSetConfig(hConn: ConnHandle; thePtr: Ptr): INTEGER;
  229.  
  230. FUNCTION     CMIntlToEnglish(hConn: ConnHandle; inputPtr: Ptr; VAR outputPtr: Ptr; 
  231.                     language: INTEGER): OSErr;
  232. FUNCTION     CMEnglishToIntl(hConn: ConnHandle; inputPtr: Ptr; VAR outputPtr: Ptr; 
  233.                     language: INTEGER): OSErr;
  234.  
  235. FUNCTION     CMAddSearch(hConn: ConnHandle; theString: Str255; flags: CMSearchFlags;
  236.                     callBack: ProcPtr): LONGINT;
  237. PROCEDURE     CMRemoveSearch(hConn: ConnHandle; refnum: LONGINT);
  238. PROCEDURE     CMClearSearch(hConn: ConnHandle);
  239.  
  240. FUNCTION     CMGetConnEnvirons(hConn: ConnHandle; VAR theEnvirons: ConnEnvironRec): CMErr;
  241.  
  242. FUNCTION     CMChoose(VAR hConn: ConnHandle; where: Point; idleProc: ProcPtr): INTEGER;
  243.  
  244. PROCEDURE     CMEvent(hConn: ConnHandle; theEvent: EventRecord);
  245.                     
  246. PROCEDURE     CMGetToolName(procID: INTEGER; VAR name: Str255);
  247. FUNCTION      CMGetProcID(name: Str255): INTEGER;
  248.  
  249. PROCEDURE     CMSetRefCon(hConn: ConnHandle; refCon: LONGINT);
  250. FUNCTION     CMGetRefCon(hConn: ConnHandle): LONGINT;
  251.  
  252. PROCEDURE     CMSetUserData(hConn: ConnHandle; userData: LONGINT);
  253. FUNCTION     CMGetUserData(hConn: ConnHandle): LONGINT;
  254.  
  255.  
  256. {$ENDC} {UsingConnections}
  257.  
  258. {$IFC NOT UsingIncludes}
  259.     END.
  260. {$ENDC}
  261.  
  262.